<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .time {
            width: 500px;
            height: 100px;
            border: 5px solid red;
            margin: 50px auto;
            box-shadow: 0 0 15px blue;
            text-shadow: 0 0 15px orchid;
            font-size: 50px;
            text-align: center;
            font-weight: bold;
            line-height: 100px;
        }
    </style>
</head>
<body>
    <div class="time">
        <span></span>：<span></span>：<span></span>
    </div>
    <script>
window.onload = function () {
            function time() {
                let Dat = new Date()
                let hours = Dat.getHours()
                let min = Dat.getMinutes()
                let s = Dat.getSeconds()
                let arr = [hours,min,s]
                var sPan = document.querySelectorAll("span")
                arr.forEach(function(item,index){
                    item = item.toString()
                    item = item.padStart(2, 0)
                   sPan[index].innerHTML = item
                })
            }
            setInterval(time, 1000)
        }
    </script>
</body>
</html>